
package entities;
import java.io.Serializable;
import java.util.Comparator;

/**
 * Objecto que representa um lugar de um teatro
 * 
 * @author Leonardo Lino Nº45340
 * @author Diogo Pires Nº40351
 */
public class Lugar implements Comparable<Lugar>, Serializable{
	public static final int STATE_FREE = 0;
	public static final int STATE_RESERVED = 1;
	public static final int STATE_BOUGHT = 2;
	public int id;
	public int row;
	public int column;
	public int state;
	public int userID = 0;
	public String timestamp;
	
	public static final Comparator<Lugar> DESCENDING_COMPARATOR = new Comparator<Lugar>() {
		public int compare(Lugar o1, Lugar o2){
			return o1.id - o2.id;
		}
	};
	
	public Lugar(int id, int row, int column, int state){
		this.id = id;
		this.row = row;
		this.column = column;
		this.state = state;
	}
	
	public int getUserID() {
		return userID;
	}

	public void setUserID(int userID) {
		this.userID = userID;
	}

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getRow() {
        return row;
    }

    public void setRow(int row) {
        this.row = row;
    }

    public int getColumn() {
        return column;
    }

    public void setColumn(int column) {
        this.column = column;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }        

	public String getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(String timestamp) {
		this.timestamp = timestamp;
	}

	@Override
	public int compareTo(Lugar o) {
		return Integer.toString(this.id).compareTo(Integer.toString(o.id));
	}
}

